package com.yyf.blogapi.controller;


import com.yyf.blogapi.service.ICategoryService;
import com.yyf.blogapi.vo.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author yyf
 * @since 2021-08-16
 */
@RestController
@RequestMapping("/categorys")
public class CategoryController {

    @Resource
    ICategoryService categoryService;

    @GetMapping
    public Result categorys() {
        return Result.success(categoryService.list());
    }

    @GetMapping("/detail")
    public Result categorysDetail(){
        return Result.success(categoryService.list());
    }

    @GetMapping("/detail/{id}")
    public Result categoryDetail(@PathVariable Long id){
        return Result.success(categoryService.getById(id));
    }

}
